package com.cloudcc.mobile.view.aduit.adapter;

import android.content.Context;

import com.cloudcc.cloudframe.adapter.NewCommonAdapter;
import com.cloudcc.cloudframe.adapter.ViewHolder;
import com.cloudcc.mobile.R;
import com.cloudcc.mobile.view.aduit.bean.shopBean;


/**
 * Created by lin on 2017/5/10.
 */

public class NearByShopAdapter extends NewCommonAdapter {

    public NearByShopAdapter(Context mContext) {
        super(mContext);
    }

    @Override
    public void convert(ViewHolder holder, Object o, int position) {
        shopBean shopBean = (shopBean) o;
        holder.setText(R.id.near_by_list_item_name , (position+1)+"."+shopBean.getName());
        String distanceNow = String.format(mContext.getResources().getString(R.string.near_by_now_distance), shopBean.getDistance()+"m");
        holder.setText(R.id.near_by_list_item_long , (shopBean.getDistance() == -1 ? mContext.getString(R.string.null_now) : distanceNow));
        holder.setText(R.id.near_by_list_item_address , shopBean.getMddz());
    }


    @Override
    public int getLayoutId() {
        return R.layout.near_by_list_item;
    }

}
